﻿SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ARITHABORT ON
GO
SET NUMERIC_ROUNDABORT OFF
GO
SET CONCAT_NULL_YIELDS_NULL ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_WARNINGS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE bhp_temp_SomeChangesWithPhotos
AS
BEGIN

	DECLARE
		@GroupId		INT,
		@PhotosId		INT,
		@CategoryId	INT

	EXEC [dbo].[n_TableAdd] 'SYS_GALERIA_HOTELU', 900900
		SELECT @GroupId = id FROM n_Tree t WHERE t.name = 'SYS_GALERIA_HOTELU'

	SELECT @PhotosId = id FROM n_Tree t WHERE t.name = 'ZDJECIA_APARTAMENTOW'

	INSERT INTO bht_Groups (Id, Name, [ReadOnly], EnableTranslate, Identyficator) VALUES (@GroupId, 'Galeria hotelu', 1, 0, 'Galeria hotelu')
	
	EXEC [dbo].[n_ColFNAdd] @tab = @GroupId, @name = N'zdjecia', @rel = @PhotosId, @user = 900900

	INSERT INTO bht_Columns (ColumnId, DisplayName, [Description], Sort, CustomEditControl)
    SELECT
        id, N'Zdjęcia', N'', 1, N'blackhouse.WebNemo.Web.Controls.ReferenceGallery.EditReferenceGallery,blackhouse.WebNemo.Web'
    FROM
        n_Tree t
    WHERE
        parent = @GroupId
        AND name = N'zdjecia'


	INSERT INTO SYS_GALERIA_HOTELU (del, identyfikator, ctime, cuser) VALUES (0, 'Galeria hotelu', GETDATE(), 7000002)

	INSERT INTO ZDJECIA_KATEGORIE (del, identyfikator, ctime, cuser, nazwa_kategorii) VALUES (0, 'Hotel', GETDATE(), 7000002, 'Hotel')

END
GO
EXEC bhp_temp_SomeChangesWithPhotos
GO
DROP PROCEDURE bhp_temp_SomeChangesWithPhotos